<?
//Import Classes
	require_once('classes/session.php');
	require_once('classes/sql_wtc.php');
	require_once('classes/functions.php');
	
	$myDB = new MySQL_class();
	$myDB->Create();
	
	$sql="select * from pro_category;";
	$myDB->Query($sql);
	$r1=$myDB->result;
	if ($r1) {
		while ($rec=mysql_fetch_object($r1)){
			$sql="select id from pro_category where name='".$rec->parent."'";
			$myDB->Query($sql);
			$temp=mysql_fetch_object($myDB->result);
			$sql="update pro_category set parent='".$temp->id."' where id=".$rec->id.";";
			$myDB->Query($sql);
			if ($myDB->result) {
				echo $rec->id." : ".$rec->parent." -&gt; ".$temp->id."<br>\n";
			}
			else echo $rec->id." : ".$rec->parent." <font color=#FF3333>FAILED</font> <br>\n";
		}
	}

	$sql="select * from pro_basic;";
	$myDB->Query($sql);
	$r1=$myDB->result;
	if ($r1) {
		while ($rec=mysql_fetch_object($r1)){
			$sql="select id from pro_category where name='".$rec->category."'";
			$myDB->Query($sql);
			$temp1=mysql_fetch_object($myDB->result);
			$sql="select id from pro_category where name='".$rec->parent_category."'";
			$myDB->Query($sql);
			$temp2=mysql_fetch_object($myDB->result);
			$sql="update pro_basic set category='".$temp1->id."',parent_category='".$temp2->id."' where id=".$rec->id.";";
			$myDB->Query($sql);
			if ($myDB->result) {
				echo $rec->id." : ".$rec->category." -&gt; ".$temp1->id." , ".$rec->parent_category." -&gt; ".$temp2->id."<br>\n";
			}
			else echo $rec->id." : ".$rec->parent." , ".$rec->parent_category."  <font color=#FF3333>FAILED</font> <br>\n";
		}
	}
	
	@mysql_close();
?>